/********************************************************/
/*	Author:		gong_libin			*/
/*	Date:		2014_08_08			*/
/*	File:		GtGlobal.h			*/
/********************************************************/

#ifndef	_GTGLOBAL_H
#define	_GTGLOBAL_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define	UINT				unsigned int
#define	UCHAR				unsigned char
#define	ULONG				unsigned long
#define	USHORT				unsigned short
#define	ULONGLONG			unsigned long long

#define	GT_BYTE16			16
#define	GT_BYTE32			32
#define	GT_BYTE64			64

#define	GT_BYTE128			128
#define	GT_BYTE256			256
#define	GT_BYTE512			512

#define	GT_KBYTES1			1024
#define	GT_KBYTES2			2048
#define	GT_KBYTES4			4096
#define	GT_KBYTES8			8192

#define	GT_BUFFER			512
#define	GT_PACKET			1024

#define	GT_SUCCESS			0
#define	GT_FAILURE			-1

#define	GT_PRINT(format, args...)	do {				\
	fprintf(stdout, format, ##args);				\
	fflush(stdout);							\
} while (0)

#define	GT_ERROR(format, args...)	do {				\
	fprintf(stderr, "[ERROR] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stderr, format, ##args);				\
} while (0)

#define	GT_DEBUG(format, args...)	do {				\
	fprintf(stdout, "[DEBUG] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stdout, format, ##args);				\
	fflush(stdout);							\
} while (0)

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _GTGLOBAL_H */
